

#ifndef UD_DBLYINDX_H
#define UD_DBLYINDX_H

#include "zdbindex.h"

#pragma pack (push, 8)

class UcDbLayerIndex: public UcDbIndex
{
public:
    UCDB_DECLARE_MEMBERS(UcDbLayerIndex);
	     UcDbLayerIndex();
    virtual ~UcDbLayerIndex();
    virtual UcDbFilteredBlockIterator* newIterator(const UcDbFilter* pFilter)
                                                   const;

    virtual Ucad::ErrorStatus rebuildFull(UcDbIndexUpdateData* pIdxData);

    Ucad::ErrorStatus compute(UcDbLayerTable*       pLT,
                              UcDbBlockTableRecord* pBTR);

protected:
    virtual Ucad::ErrorStatus rebuildModified(UcDbBlockChangeIterator* iter);
};

class UcDbImpLayerIndexIterator;
class UcDbLayerFilter;

class UcDbLayerIndexIterator : public UcDbFilteredBlockIterator
{
public:
    UcDbLayerIndexIterator(const UcDbLayerIndex*  pIndex,
                           const UcDbLayerFilter* pFilter);
    virtual ~UcDbLayerIndexIterator();

    virtual Ucad::ErrorStatus start();
    virtual UcDbObjectId      next();
    virtual UcDbObjectId      id() const;
    virtual Ucad::ErrorStatus seek(UcDbObjectId id);

    virtual double estimatedHitFraction() const;
    virtual Ucad::ErrorStatus accepts(UcDbObjectId id, 
                      ZSoft::Boolean& idPassesFilter) const;

private:
        UcDbImpLayerIndexIterator* mpImpIter;
};

#pragma pack (pop)

#endif 
